package com.qwt.part_time_api.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.qwt.part_time_api.error.BusinessException;
import com.qwt.part_time_api.service.RegisterService;
import com.qwt.part_time_api.vo.Result;
import com.qwt.part_time_api.vo.params.RegisterParams;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 君子慎独
 * @create 2022/1/20 0020 0:45
 */
@RestController
@RequestMapping("/register")
@Api(tags = {"注册"})
public class RegisterController {

    @Autowired
    private RegisterService registerService;

    @PostMapping("/userRegister")
    @ApiOperation(value = "用户注册", notes = "用于注册用户")
    @ApiOperationSupport(author = "Tzeao")
    @ApiResponses(@ApiResponse(code = 200, message = "成功"))
    public Result userRegister(@RequestBody RegisterParams params) throws BusinessException {
        return registerService.saveUser(params);
    }
}
